from core import PeaceType;
class MotionCommand():

    def __init__(self, sP, fP, board):
        self._board = board;
        self._sP = sP;
        self._fP = fP;

    def execute(self):
        self._oldStartState = self._board.matrix[self._sP.y][self._sP.x];
        self._oldFinalState = self._board.matrix[self._fP.y][self._fP.x];
        self._board.matrix[self._fP.y][self._fP.x] = self._oldStartState;
        self._board.matrix[self._sP.y][self._sP.x] = PeaceType.BLANK_CELL;

    def undo(self):
        self._board.matrix[self._sP.y][self._sP.x] = self._oldStartState;
        self._board.matrix[self._fP.y][self._fP.x] = self._oldFinalState;